From: Steven G. Johnson Date: Sun, 11 Dec 2016 12:15:53 +0000 (-0500) Subject: use stdbool.h and inttypes.h in MSVC 2013 and later, and use more C99-compatible... X-Git-Tag: archive/raspbian/2.11.3-2+rpi1^2~10^2~1^2~139 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=59334e44999a527ee27f29e8dddd9daa1fda1980;p=utf8proc.git use stdbool.h and inttypes.h in MSVC 2013 and later, and use more C99-compatible definitions of false and true earlier (fix #90) --- diff --git a/utf8proc.h b/utf8proc.h index 96328fb..99b4fdb 100644 --- a/utf8proc.h +++ b/utf8proc.h @@ -78,7 +78,8 @@ #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1800 +// MSVC prior to 2013 lacked stdbool.h and inttypes.h typedef signed char utf8proc_int8_t; typedef unsigned char utf8proc_uint8_t; typedef short utf8proc_int16_t; @@ -93,8 +94,13 @@ typedef int utf8proc_ssize_t; typedef unsigned int utf8proc_size_t; # endif # ifndef __cplusplus +// emulate C99 bool typedef unsigned char utf8proc_bool; -enum {false, true}; +# ifndef __bool_true_false_are_defined +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 +# endif # else typedef bool utf8proc_bool; # endif